package com.vito.dcs.water.action;

import com.alibaba.dubbo.config.annotation.Reference;
import com.vito.base.authoriza.action.BaseAction;
import com.vito.base.authoriza.cache.SessionMap;
import com.vito.base.authoriza.model.UserModel;
import com.vito.base.model.Result;
import com.vito.base.tools.I18nResMsg;
import com.vito.base.util.Validata;
import com.vito.dcs.water.device.model.WaterBlenderModel;
import com.vito.dcs.water.device.model.WaterPoreModel;
import com.vito.dcs.water.device.service.WaterPoreService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

/**
 * @program: WaterPoreAction
 * @description: 水稳搅拌机设备设置筛孔表请求控制器
 * @author: rongr
 * @create: 2019/04/11
 */
@Controller
@RequestMapping("/dcs/water/pore")
public class WaterPoreAction extends BaseAction {

    private static final Logger log = LoggerFactory.getLogger(WaterPoreAction.class);

    @Reference
    private WaterPoreService waterPoreService;

    /**
     * 根据Id查询WaterPoreModel对象
     *
     * @Param: [map]
     * @return: com.vito.base.model.Result
     */
    @RequestMapping("/queryWaterPoreByBlenderId")
    @ResponseBody
    public Result queryWaterPoreByBlenderId(@RequestParam Map<String, Object> map) {
        Result res = new Result();
        try {
            List<WaterPoreModel> modelList = waterPoreService.queryWaterPoreByBlenderId(map);
            res.setCode(Result.CODE_OK);
            res.setData(modelList);
        } catch (Exception e) {
            res.setCode(Result.CODE_ERROR);
            res.setMsg("查询失败");
            log.error("查询WaterBlender失败", e);
        }
        return res;
    }

}

